home *** CD-ROM | disk | FTP | other *** search
/ ftp.cs.arizona.edu / ftp.cs.arizona.edu.tar / ftp.cs.arizona.edu / icon / newsgrp / group97a.txt / 000104_icon-group-sender _Wed Apr 9 06:50:35 1997.msg < prev    next >
Text File  |  2000-09-20  |  2KB  |  57 lines

  1. Message-Id: <199704091946.AA11186@cheltenham.cs.arizona.edu>
  2. Received: by cheltenham.cs.arizona.edu; Wed, 9 Apr 1997 12:46:46 MST
  3. From: swampler@noao.edu (Steve Wampler)
  4. Date: Wed, 9 Apr 1997 06:50:35 MST
  5. To: icon-group@cs.arizona.edu
  6. Subject: Re: Problem with Icon 9.3
  7. Errors-To: icon-group-errors@cs.arizona.edu
  8. Status: RO
  9. Content-Length: 1626
  10.  
  11. On Apr 8 at  2:02pm, Eka Laiman writes:
  12. } > I have the following simple (I think) program:
  13. } > 
  14. } > link ximage
  15. } > 
  16. } > procedure main()
  17. } > 
  18. } >   # The state diagram.
  19. } >   sd := table([])
  20. } >   sd[["q0","ok"]] := "q1"
  21. } >   sd[["q0","nok"]] := "q0"
  22. } >   sd[["q1","nok"]] := "q0"
  23. } >   sd[["q1","ok"]] := "q2"
  24. } >   # q2 is the final state
  25. } > 
  26. } >   every x := key(sd) do write(ximage(x), ":", sd[x])
  27. } > 
  28. } > end
  29. } > 
  30. } > This doesn't behave as I think it should.  The problem seems to be a
  31. } > table whose keys are lists.  Is there something wrong with this kind of
  32. } > structure?  I don't see anything to that effect in the 3d edition of the
  33. } > Icon book, Ch. 6 on tables.
  34. } Wow, indexing using "list"s?
  35. } I do not know if ICON's tables are built with this kind of operation in
  36. } mind. I personally think that ICON tables are like "hash table" where the
  37. } indexing can be done using both "strings" or "integers". According to the
  38. } definition: "Tables resemble lists, except that the keys, or 'subscripts',
  39. } need not be integers but can be *values of any type*." I have not tried to
  40. } do indexing based on "float" yet, although theoretically that's possible
  41. } :-)
  42. } If I were you, I would first convert the list into "string" and use the
  43. } resulting string as the key.
  44.  
  45. There is nothing at all wrong with indexing tables with anything, including
  46. lists, sets, and tables.  In fact, his code works on my system exactly
  47. as I would expect.
  48.  
  49.  
  50. -- 
  51. Steve Wampler - swampler@gemini.edu [Gemini 8m Telescopes Project (under AURA)]
  52. O Sibile, si ergo, fortibus es inero.
  53. Nobile, demis trux.  Demis phulla causan dux.
  54.